﻿<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Elpur._Default" %>

<asp:Content runat="server" ID="FeaturedContent" ContentPlaceHolderID="FeaturedContent">
    <section class="featured">
        <div class="content-wrapper">
            <hgroup class="title">
                
                <h1> Choose Country Name For Development Indicator - 
                    <asp:DropDownList ID="_countryList" runat="server" AutoPostBack="true" Width="250" Font-Size="X-Large">
                    </asp:DropDownList>
                </h1>
            </hgroup>
            
            <br />
            <asp:Table runat="server" ID="myTbl" Width="960">
                <asp:TableRow Width="960" Font-Names="Courier New">
                    <asp:TableCell ID="_cellcontent" Width="480" BackColor="White" VerticalAlign="Top" HorizontalAlign="Left">
                        Country Name : 
                        <asp:Label ID="_info_countryname" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        Capital City :
                        <asp:Label ID="_info_capitalcity" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        Region Name :
                        <asp:Label ID="_info_regionname" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        Region Code :
                        <asp:Label ID="_info_regioncode" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        ISO Code :
                        <asp:Label ID="_info_codeiso" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        Income Level :
                        <asp:Label ID="_info_incomelevel" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        Lending Type Code :
                        <asp:Label ID="_info_lendingtypecode" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                        Lending Type Name
                        <asp:Label ID="_info_lendingtypename" runat="server" Font-Size="X-Large" ForeColor="Black"></asp:Label><br />
                    </asp:TableCell>
                    <asp:TableCell Width="480" BorderStyle="Double" BorderColor="Black" HorizontalAlign="Center" VerticalAlign="Middle">
                       <div id='mapDiv' style="position:relative; width:400px; height:400px;"></div> 
                    </asp:TableCell>
                </asp:TableRow>
            </asp:Table>
        </div>
        <script type="text/javascript">
            function GetMap() {
                var latitude = parseFloat('<%=_latitude%>');
                var longitude = parseFloat('<%=_longitude%>');
                var countryname = '<%=_countryname%>';
                var capitalcity = '<%=_capitalcity%>';
                var map = null;
                map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), {
                    credentials:
            "Ak4aBfGm0YvIMs57b1E13r0J-l0gX0WCcvbSh9Nqi24R5hnD04xMeQKDKn6Mywlr"
                });
                var viewRect = Microsoft.Maps.LocationRect.fromCorners(new Microsoft.Maps.Location(latitude+3, longitude-3), new Microsoft.Maps.Location(latitude-3, longitude+3));
                var center = new Microsoft.Maps.Location(latitude, longitude);
                var pin = new Microsoft.Maps.Pushpin(center, { text: '' });
                if (latitude != 0 && longitude != 0)
                    pinInfobox = new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(latitude + 0.5, longitude), { title: "<i> Capital - "+capitalcity + "</i><br> <i> Country - "+countryname+"</i>", visible: true, width: 200, height: 80, });
                else
                    pinInfobox = new Microsoft.Maps.Infobox(new Microsoft.Maps.Location(latitude + 0.5, longitude), { title: "Not Available", visible: true, width: 200, height: 80, });
                Microsoft.Maps.Events.addHandler(pin, 'click', displayInfobox);
                map.setView({ bounds: viewRect });
                map.entities.push(pin);
                setTimeout(function () { map.entities.push(pinInfobox) }, 0);
            }

            function displayInfobox(e) {
                pinInfobox.setOptions({ visible: true });
            }

            function hideInfobox(e) {
                pinInfobox.setOptions({ visible: false });
            }
        </script>
    </section>
</asp:Content>
